-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Lang] Support the functions of dataclass as kernel argument and return value #7865
Merged
+54
−0
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ Deploy Preview for docsite-preview ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
ailzhang
approved these changes
Apr 23, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
lin-hitonami
added a commit
to lin-hitonami/taichi
that referenced
this pull request
Apr 27, 2023
…rn value (taichi-dev#7865) Issue: fixes taichi-dev#7822 <!-- copilot:all --> ### <samp>🤖 Generated by Copilot at 4ae87d7</samp> ### Summary 🧪🛠️🚀 <!-- 1. 🧪 - This emoji represents testing, experimentation, or science, and can be used to indicate the addition of test cases or the verification of functionality. 2. 🛠️ - This emoji represents tools, construction, or repair, and can be used to indicate the addition of a new feature or the improvement of an existing one. 3. 🚀 - This emoji represents speed, launch, or innovation, and can be used to indicate the enhancement of performance, the expansion of capabilities, or the introduction of a novel idea. --> This pull request enables data classes defined by `ti.dataclass` to have methods decorated by `ti.func` and `ti.kernel`. It also adds tests to check the functionality and correctness of this feature. > _`StructType` creates the data class of doom_ > _With `__struct_methods` to unleash its power_ > _Call them from Python, or pass them to `ti.kernel`_ > _`ti.func` returns them, the ultimate metal_ ### Walkthrough * Add `__struct_methods` attribute to data class dictionaries to enable access of methods defined in `ti.dataclass` decorator ([link](https://github.com/taichi-dev/taichi/pull/7865/files?diff=unified&w=0#diff-3154e0533b9fd63e663c16c2e87c65068c3b002a65cf80529b6577d173bdb5feR633), [link](https://github.com/taichi-dev/taichi/pull/7865/files?diff=unified&w=0#diff-3154e0533b9fd63e663c16c2e87c65068c3b002a65cf80529b6577d173bdb5feR654)) * Add test cases for using `ti.func` and `ti.kernel` as methods of data classes, both as kernel arguments and kernel returns, in `test_struct.py` ([link](https://github.com/taichi-dev/taichi/pull/7865/files?diff=unified&w=0#diff-e87bf5cb1cd09e10b5cfa001ab2ef18f31a242db3a7b66ee98a76d60b1615e71R79-R130))
feisuzhu
pushed a commit
to feisuzhu/taichi
that referenced
this pull request
Apr 27, 2023
…rn value (taichi-dev#7865) Issue: fixes taichi-dev#7822 <!-- copilot:all --> ### <samp>🤖 Generated by Copilot at 4ae87d7</samp> ### Summary 🧪🛠️🚀 <!-- 1. 🧪 - This emoji represents testing, experimentation, or science, and can be used to indicate the addition of test cases or the verification of functionality. 2. 🛠️ - This emoji represents tools, construction, or repair, and can be used to indicate the addition of a new feature or the improvement of an existing one. 3. 🚀 - This emoji represents speed, launch, or innovation, and can be used to indicate the enhancement of performance, the expansion of capabilities, or the introduction of a novel idea. --> This pull request enables data classes defined by `ti.dataclass` to have methods decorated by `ti.func` and `ti.kernel`. It also adds tests to check the functionality and correctness of this feature. > _`StructType` creates the data class of doom_ > _With `__struct_methods` to unleash its power_ > _Call them from Python, or pass them to `ti.kernel`_ > _`ti.func` returns them, the ultimate metal_ ### Walkthrough * Add `__struct_methods` attribute to data class dictionaries to enable access of methods defined in `ti.dataclass` decorator ([link](https://github.com/taichi-dev/taichi/pull/7865/files?diff=unified&w=0#diff-3154e0533b9fd63e663c16c2e87c65068c3b002a65cf80529b6577d173bdb5feR633), [link](https://github.com/taichi-dev/taichi/pull/7865/files?diff=unified&w=0#diff-3154e0533b9fd63e663c16c2e87c65068c3b002a65cf80529b6577d173bdb5feR654)) * Add test cases for using `ti.func` and `ti.kernel` as methods of data classes, both as kernel arguments and kernel returns, in `test_struct.py` ([link](https://github.com/taichi-dev/taichi/pull/7865/files?diff=unified&w=0#diff-e87bf5cb1cd09e10b5cfa001ab2ef18f31a242db3a7b66ee98a76d60b1615e71R79-R130))
quadpixels
pushed a commit
to quadpixels/taichi
that referenced
this pull request
May 13, 2023
…rn value (taichi-dev#7865) Issue: fixes taichi-dev#7822 <!-- copilot:all --> ### <samp>🤖 Generated by Copilot at 4ae87d7</samp> ### Summary 🧪🛠️🚀 <!-- 1. 🧪 - This emoji represents testing, experimentation, or science, and can be used to indicate the addition of test cases or the verification of functionality. 2. 🛠️ - This emoji represents tools, construction, or repair, and can be used to indicate the addition of a new feature or the improvement of an existing one. 3. 🚀 - This emoji represents speed, launch, or innovation, and can be used to indicate the enhancement of performance, the expansion of capabilities, or the introduction of a novel idea. --> This pull request enables data classes defined by `ti.dataclass` to have methods decorated by `ti.func` and `ti.kernel`. It also adds tests to check the functionality and correctness of this feature. > _`StructType` creates the data class of doom_ > _With `__struct_methods` to unleash its power_ > _Call them from Python, or pass them to `ti.kernel`_ > _`ti.func` returns them, the ultimate metal_ ### Walkthrough * Add `__struct_methods` attribute to data class dictionaries to enable access of methods defined in `ti.dataclass` decorator ([link](https://github.com/taichi-dev/taichi/pull/7865/files?diff=unified&w=0#diff-3154e0533b9fd63e663c16c2e87c65068c3b002a65cf80529b6577d173bdb5feR633), [link](https://github.com/taichi-dev/taichi/pull/7865/files?diff=unified&w=0#diff-3154e0533b9fd63e663c16c2e87c65068c3b002a65cf80529b6577d173bdb5feR654)) * Add test cases for using `ti.func` and `ti.kernel` as methods of data classes, both as kernel arguments and kernel returns, in `test_struct.py` ([link](https://github.com/taichi-dev/taichi/pull/7865/files?diff=unified&w=0#diff-e87bf5cb1cd09e10b5cfa001ab2ef18f31a242db3a7b66ee98a76d60b1615e71R79-R130))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: fixes #7822
🤖 Generated by Copilot at 4ae87d7
Summary
🧪🛠️🚀
This pull request enables data classes defined by
ti.dataclass
to have methods decorated byti.func
andti.kernel
. It also adds tests to check the functionality and correctness of this feature.Walkthrough
__struct_methods
attribute to data class dictionaries to enable access of methods defined inti.dataclass
decorator (link, link)ti.func
andti.kernel
as methods of data classes, both as kernel arguments and kernel returns, intest_struct.py
(link)